using System.ComponentModel.DataAnnotations;

namespace ProcessManagementApi.DTO
{
    /// <summary>
    /// 工序分类查询DTO
    /// </summary>
    public class ProcessCategoryQueryDto
    {
        /// <summary>
        /// 页索引（从1开始）
        /// </summary>
        [Range(1, int.MaxValue, ErrorMessage = "页索引必须大于0")]
        public int PageIndex { get; set; } = 1;

        /// <summary>
        /// 页大小
        /// </summary>
        [Range(1, 100, ErrorMessage = "页大小必须在1-100之间")]
        public int PageSize { get; set; } = 10;

        /// <summary>
        /// 工序分类编号或名称（模糊查询）
        /// </summary>
        public string? NumberOrName { get; set; }

        /// <summary>
        /// 状态筛选（启用/禁用）
        /// </summary>
        public bool? IsActive { get; set; }
    }

    /// <summary>
    /// 工序分类导出查询DTO（继承自查询DTO但不包含分页参数）
    /// </summary>
    public class ProcessCategoryExportQueryDto
    {
        /// <summary>
        /// 工序分类编号或名称（模糊查询）
        /// </summary>
        public string? NumberOrName { get; set; }

        /// <summary>
        /// 状态筛选（启用/禁用）
        /// </summary>
        public bool? IsActive { get; set; }
    }

    /// <summary>
    /// 工序分类结果DTO
    /// </summary>
    public class ProcessCategoryResultDto
    {
        /// <summary>
        /// ID
        /// </summary>
        public int Id { get; set; }

        /// <summary>
        /// 工序分类编号
        /// </summary>
        public string ProcessCategoryNumber { get; set; } = string.Empty;

        /// <summary>
        /// 工序分类名称
        /// </summary>
        public string ProcessCategoryName { get; set; } = string.Empty;

        /// <summary>
        /// 排序
        /// </summary>
        public int SortOrder { get; set; }

        /// <summary>
        /// 状态 (启用/禁用)
        /// </summary>
        public bool IsActive { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        public string? Remarks { get; set; }

        /// <summary>
        /// 该分类下的工序数量
        /// </summary>
        public int ProcessCount { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime CreateTime { get; set; }

        /// <summary>
        /// 创建人
        /// </summary>
        public string? Creator { get; set; }

        /// <summary>
        /// 更新时间
        /// </summary>
        public DateTime? UpdateTime { get; set; }

        /// <summary>
        /// 更新人
        /// </summary>
        public string? Updator { get; set; }
    }

    /// <summary>
    /// 工序分类创建DTO
    /// </summary>
    public class ProcessCategoryCreateDto
    {
        /// <summary>
        /// 工序分类编号
        /// </summary>
        [Required(ErrorMessage = "工序分类编号不能为空")]
        [StringLength(50, ErrorMessage = "工序分类编号长度不能超过50个字符")]
        public string ProcessCategoryNumber { get; set; } = string.Empty;

        /// <summary>
        /// 工序分类名称
        /// </summary>
        [Required(ErrorMessage = "工序分类名称不能为空")]
        [StringLength(100, ErrorMessage = "工序分类名称长度不能超过100个字符")]
        public string ProcessCategoryName { get; set; } = string.Empty;

        /// <summary>
        /// 排序
        /// </summary>
        public int SortOrder { get; set; } = 0;

        /// <summary>
        /// 状态 (启用/禁用)
        /// </summary>
        public bool IsActive { get; set; } = true;

        /// <summary>
        /// 备注
        /// </summary>
        [StringLength(500, ErrorMessage = "备注长度不能超过500个字符")]
        public string? Remarks { get; set; }
    }

    /// <summary>
    /// 工序分类更新DTO
    /// </summary>
    public class ProcessCategoryUpdateDto
    {
        /// <summary>
        /// ID
        /// </summary>
        [Required(ErrorMessage = "ID不能为空")]
        public int Id { get; set; }

        /// <summary>
        /// 工序分类编号
        /// </summary>
        [Required(ErrorMessage = "工序分类编号不能为空")]
        [StringLength(50, ErrorMessage = "工序分类编号长度不能超过50个字符")]
        public string ProcessCategoryNumber { get; set; } = string.Empty;

        /// <summary>
        /// 工序分类名称
        /// </summary>
        [Required(ErrorMessage = "工序分类名称不能为空")]
        [StringLength(100, ErrorMessage = "工序分类名称长度不能超过100个字符")]
        public string ProcessCategoryName { get; set; } = string.Empty;

        /// <summary>
        /// 排序
        /// </summary>
        public int SortOrder { get; set; } = 0;

        /// <summary>
        /// 状态 (启用/禁用)
        /// </summary>
        public bool IsActive { get; set; } = true;

        /// <summary>
        /// 备注
        /// </summary>
        [StringLength(500, ErrorMessage = "备注长度不能超过500个字符")]
        public string? Remarks { get; set; }
    }
} 